<?php 
//require_once("../../../../generales/lib/adodb5/adodb.inc.php");
require_once("../generales/lib/adodb5/adodb.inc.php");

class conexionAdo5
{

	var $conn;
	var $dsn;
	function conexionAdo5()
	{
		$this->conn="";
	}
	function conectar($driver,$server,$user,$pws,$port,$sid)
	{
                //Soporte a Data Source Name DSN
		if($driver=='mysql'){
 			$this->conn = &ADONewConnection($driver); //Conexion con MySQL	
 			$this->conn->PConnect($server,$user,$pws,$sid);
		}
		else if($driver=='postgres'){ 
		    $this->dsn = $driver.'://'.$user.':'.$pws.'@'.$server.':'.$port.'/'.$sid.'?persist';
                     //Conexion con PostgreSQL
 			$this->conn = ADONewConnection($this->dsn); //Conexion con PostgreSQL
 			//$this->conn->PConnect($server,$user,$pws,$sid);
		}
		else if($driver=='oci8'){ 	
			$this->conn = ADONewConnection($driver); //Conexion con Oracle
			$this->conn->Connect($server, $user, $pws, $sid);	
		}
		else if($driver=='ibase'){ 
 			$this->conn = &ADONewConnection($driver); //Conexion con InterBase	
 			$this->conn->PConnect($server.':'.$sid,$user,$pws);
		}

		return $this->conn;
	}
	function cerrarConexion()
	{
		$this->conn->Close();
	}
}
?>
